<?php
	require_once('config.php');
	include "fpdf/fpdf.php";

ini_set('error_reporting', E_ALL ^ E_NOTICE);
ini_set('display_errors', '0');

$tgl = $_POST['bulan'];
$tglx = date('d-M-Y');
$pdf = new FPDF();
$pdf->Open();
$pdf->addPage();
$pdf->setAutoPageBreak(false);
$pdf->setFont('Arial','',12);
$pdf->text(70,30,'LAPORAN BULANAN RTS CUP');
$pdf->text(90,40,'');
$sqlRts = mysql_query("SELECT stock_rts FROM tb_temp_rts LIMIT 1");
$getRts = mysql_fetch_array($sqlRts);
$pdf->text(27,37,'Total Stock Ready to Sale :'.$getRts['stock_rts']);
$yi = 46;
$ya = 44;
$pdf->setFont('Arial','',9);
$pdf->setFillColor(222,222,222);
$pdf->setXY(40,40);
$pdf->CELL(6,6,'NO',1,0,'C',1);
$pdf->CELL(30,6,'KODE PRODUKSI',1,0,'C',1);
$pdf->CELL(30,6,'JUMLAH',1,0,'C',1);
$pdf->CELL(30,6,'SATUAN',1,0,'C',1);
$pdf->CELL(40,6,'TANGGAL',1,0,'C',1);

$ya = $yi + $row;
$sql=mysql_query("SELECT * from tb_rts 
where MONTH(tgl)='$tgl'");
$i = 1;
$no = 1;
$max = 31;
$row = 6;
while($data = mysql_fetch_array($sql)){
$pdf->setXY(40,$ya);
$pdf->setFont('arial','',9);
$pdf->setFillColor(255,255,255);
	$rts=mysql_fetch_array(mysql_query("select * from tb_produksi where id_produksi='$data[id_prod]'"));
$pdf->cell(6,6,$no,1,0,'C',1);
$pdf->cell(30,6,$rts["kode_prod"],1,0,'L',1);
$pdf->cell(30,6,$data["jumlah"],1,0,'L',1);
$pdf->cell(30,6,$data["satuan"],1,0,'L',1);
$pdf->CELL(40,6,$data["tgl"],1,0,'C',1);
$ya = $ya+$row;
$no++;
$i++;
//$dm[kode] = $data[kdprog];
}
$pdf->text(140,$ya+20,"BOJONEGORO , ".$tglx);
$pdf->text(153,$ya+40,"PIMPINAN");
$pdf->output();
?>